// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch.Mapping;

[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.Json.SuggestContextConverter))]
public sealed partial class SuggestContext
{
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public SuggestContext(Elastic.Clients.Elasticsearch.Name name, string type)
	{
		Name = name;
		Type = type;
	}
#if NET7_0_OR_GREATER
	public SuggestContext()
	{
	}
#endif
#if !NET7_0_OR_GREATER
	[System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")]
	public SuggestContext()
	{
	}
#endif
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	internal SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel)
	{
		_ = sentinel;
	}

	public
#if NET7_0_OR_GREATER
	required
#endif
	Elastic.Clients.Elasticsearch.Name Name { get; set; }
	public Elastic.Clients.Elasticsearch.Field? Path { get; set; }
	public Elastic.Clients.Elasticsearch.Union<int, string>? Precision { get; set; }
	public
#if NET7_0_OR_GREATER
	required
#endif
	string Type { get; set; }
}

public readonly partial struct SuggestContextDescriptor<TDocument>
{
	internal Elastic.Clients.Elasticsearch.Mapping.SuggestContext Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public SuggestContextDescriptor(Elastic.Clients.Elasticsearch.Mapping.SuggestContext instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public SuggestContextDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument>(Elastic.Clients.Elasticsearch.Mapping.SuggestContext instance) => new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument>(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument> descriptor) => descriptor.Instance;

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument> Name(Elastic.Clients.Elasticsearch.Name value)
	{
		Instance.Name = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument> Path(Elastic.Clients.Elasticsearch.Field? value)
	{
		Instance.Path = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument> Path(System.Linq.Expressions.Expression<System.Func<TDocument, object?>> value)
	{
		Instance.Path = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument> Precision(Elastic.Clients.Elasticsearch.Union<int, string>? value)
	{
		Instance.Precision = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument> Type(string value)
	{
		Instance.Type = value;
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.Mapping.SuggestContext Build(System.Action<Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument>> action)
	{
		var builder = new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor<TDocument>(new Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}

public readonly partial struct SuggestContextDescriptor
{
	internal Elastic.Clients.Elasticsearch.Mapping.SuggestContext Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public SuggestContextDescriptor(Elastic.Clients.Elasticsearch.Mapping.SuggestContext instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public SuggestContextDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(Elastic.Clients.Elasticsearch.Mapping.SuggestContext instance) => new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor descriptor) => descriptor.Instance;

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Name(Elastic.Clients.Elasticsearch.Name value)
	{
		Instance.Name = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Path(Elastic.Clients.Elasticsearch.Field? value)
	{
		Instance.Path = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Path<T>(System.Linq.Expressions.Expression<System.Func<T, object?>> value)
	{
		Instance.Path = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Precision(Elastic.Clients.Elasticsearch.Union<int, string>? value)
	{
		Instance.Precision = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Type(string value)
	{
		Instance.Type = value;
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.Mapping.SuggestContext Build(System.Action<Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor> action)
	{
		var builder = new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}